﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
using System.Text;

namespace qip_history_synchronizer
{
    class MailUtils
    {
        public static bool sendEmail(string p_sSubject, string p_sBody)
        {
            bool result = false;
            //Port 587
            MailMessage msgMail = new MailMessage("vtelushkin@gmail.com", "vtelushkin.icq@gmail.com");
            msgMail.Subject = p_sSubject;
            msgMail.Body = p_sBody;
            SmtpClient client = new SmtpClient();
            client.Host = "smtp.gmail.com";
            NetworkCredential basicAuthenticationInfo = new NetworkCredential("vtelushkin@gmail.com", "");
            client.UseDefaultCredentials = false;
            client.Credentials = basicAuthenticationInfo;
            client.EnableSsl = true;
            
            try
            {
                client.Send(msgMail);
                return true;
            }
            catch (Exception e)
            {
                string Msg = e.Message;
            }

            return false;
        }
    }
}